package com.nameless.controller;

import com.nameless.entity.Car;
import com.nameless.entity.Order;
import com.nameless.service.OrderService;
import com.nameless.vo.OrderVo;
import com.nameless.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author keluoyisi
 * @program: car-parent
 * @description: 订单
 * @date 2023-02-28 18:47:56
 */
@RestController
@RequestMapping("/car/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/queryAllByParam")
    public Result queryAllByParam(@RequestBody OrderVo orderVo){
        System.out.println(orderVo);
        return orderService.queryAllByParam(orderVo);
    }

    @DeleteMapping("/deleteById")
    public Result deleteById(Integer id){
        return orderService.deleteById(id);
    }

    @PutMapping("/update")
    public Result updateOrder(@RequestBody Order order){
        return orderService.updateOrder(order);
    }

    @PutMapping("/update1")
    public Result updateOrder1(@RequestBody Order order){
        return orderService.updateOrder1(order);
    }

    @PostMapping("/insertOrder")
    public Result insertOrder(String startTime, String endTime, @RequestBody() Car car){
        return orderService.insertOrder(startTime,endTime,car);
    }

    @PostMapping("/selectOrder")
    public Result selectOrder(@RequestBody Order order){
        return orderService.selectOrder(order);
    }

}
